# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-whois
pkgname=('python2-whois' 'python-whois')
_pkgname=whois
pkgver=1.20240129.2
pkgrel=1
pkgdesc='Python module/library for retrieving WHOIS information of domains.'
url='https://pypi.org/project/whois/#files'
arch=('any')
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('0c621e84376500a53d63711e5fcac3f3265e0dcc6e529a2ff84e539d587a826fd4374699a1f919ef4201f3d99d17a2b9dccdbb7428e684e24358bfd5990e22d7')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-whois() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

package_python-whois() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

